package com.cin.cma.server.pos.service.impl;

import com.cin.cma.common.model.finixx.request.*;
import com.cin.cma.common.model.finixx.response.*;
import com.cin.cma.common.constant.FunctionCode;
import com.cin.cma.server.pos.service.IGoodsService;
import com.cin.cma.server.pos.service.IProxyRequestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 *
 * @Date：2024/11/28 16:58
 */
@Service
public class GoodsServiceImpl implements IGoodsService {
    @Autowired
    private IProxyRequestService proxyRequestService;

    /**
     * 获取分类信息
     *
     * @param model
     * @return
     */
    @Override
    public PosBigClassResponse goodsClass(PosBigClassRequest model) throws Exception {
        model.setCode(FunctionCode.POS_GET_CLASS);
        return this.proxyRequestService.context(model, PosBigClassResponse.class);
    }

    /**
     * 获取商品套餐列表
     *
     * @param model
     * @return
     */
    @Override
    public PosGoodsPackageResponse goodsPackage(PosGoodsPackageRequest model) throws Exception {
        model.setCode(FunctionCode.POS_GET_FAVOURABLE_FORMULA);
        return this.proxyRequestService.context(model, PosGoodsPackageResponse.class);
    }

    /**
     * 获取热卖商品
     *
     * @param model
     * @return
     */
    @Override
    public PosGoodsResponse goodsHot(PosGoodsHotRequest model) throws Exception {
        model.setCode(FunctionCode.POS_SELECT_HOTSALE_DTLS);
        return this.proxyRequestService.context(model, PosGoodsResponse.class);
    }

    /**
     * 获取商品列表
     *
     * @param model
     * @return
     */
    @Override
    public PosGoodsResponse goodsList(PosGoodsListRequest model) throws Exception {
        model.setCode(FunctionCode.POS_GET_GOODS);
        return this.proxyRequestService.context(model, PosGoodsResponse.class);
    }

    /**
     * 获取卖品套餐详情
     *
     * @param model
     * @return
     */
    @Override
    public PosPackageDetailsResponse goodsPackageDetails(PosPackageDetailsRequest model) throws Exception {
        model.setCode(FunctionCode.POS_GET_FAVOURABLE_FORMULA_DETAILS);
        return this.proxyRequestService.context(model, PosPackageDetailsResponse.class);
    }

    /**
     * 获取卖品取货详情
     *
     * @param model
     * @return
     * @throws Exception
     */
    @Override
    public PosOrderResponse getGoodsOrderInfo(PosOrderRequest model) throws Exception {
        model.setCode(FunctionCode.POS_SELECT_ORDER_INFO);
        return this.proxyRequestService.context(model, PosOrderResponse.class);
    }
}
